<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录</title>
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/login.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/jquery.in.js"></script>
    <script src="../js/cookie.js"></script>
    <script>
        $(function () {

            $('button').on('click', function () {
                $.get('../php/login.php', {
                    "phone": $('.username').val(),
                    "password": $('.password').val()
                }, function (data) {
                    var a = JSON.parse(data);
                    if (a.hash) {
                        location.href = '../html/fvancl.html';
                        additem($('.username').val(), $('.password').val());
                    
                    } else {
                        console.log(a.msg);
                        $('.cl').html(a.msg);
                        additem();
                    }
                });
                
            });
        });
        function additem(username,psd) {
            var user = cookie.get('user'); //获取cookie
            var product = {
                "username": username,
                "psd":psd
            };
            console.log(product);
            if (user) {
                user = JSON.parse(user);
                // console.log(user);

                if (user.some(elm => elm.username == username)) {
                    user.forEach((elm, i) => {
                        elm.username == username? elm.username = username : null;
                    });
                } else {
                    user.push(product);
                }
                cookie.set('user', JSON.stringify(user), 1);
            } else {
                user = [];
                user.push(product);
                cookie.set('user', JSON.stringify(user), 1);
            }


        }
    </script>
</head>

<body>
    <!-- 头部 -->
    <header class="wrapper">
        <div class="top">
            <a href="./fvancl.html">
                <img src="../img/logo18546.png" alt="">
            </a>
            <a href="javascript:;" class="help">帮助</a>
        </div>
    </header>
    <!-- 主体 -->
    <main>
        <div class="wrp">
            <div class="lo-re">
                <h3>
                    凡客 Vancl 登录
                    <span>
                        没有账户免费<a href="./regist.html">注册</a>
                    </span>
                </h3>
            </div>
            <div class="section">
                <div class="all">
                    <div class="nav">
                        <a class="login on">普通登陆</a>
                        <a class="login">快速登陆</a>
                    </div>
                    <div class="contentbox">
                        <div class="box active">
                            <div class="cont-1">
                                <input class="icon username" name="txt" type="text" placeholder="请输入用户名">
                                <input class="icon password" name="psd" type="password" placeholder="请输入密码">
                                <div class="bt">
                                    <a href="#">忘记密码</a>
                                    <div class="cl"
                                        style="position: absolute;width: 240px;height: 20px;color: #a10000;text-align: left">
                                    </div>
                                    <button
                                        style="width: 360px;height: 45px;background-color: #b42025;font-size: 20px;color:#fff;cursor: pointer">登
                                        录</button>
                                </div>
                                <div class="about">
                                    <div class="lines"></div>
                                    <div class="glup">
                                        <span class="blank10"></span>
                                        <h2 class="hezuo">使用合作网站账号登录凡客</h2>
                                        <p class="log-h">
                                            <a href="javascript:;"></a>
                                            <a href="javascript:;"></a>
                                            <a href="javascript:;"></a>
                                            <a href="javascript:;"></a>
                                            <a href="javascript:;"></a>
                                            <a href="javascript:;"></a>
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="box">
                            <div class="cont-2">
                                <ul>
                                    <li>
                                        <input type="text" id="phone" placeholder="输入手机号">
                                        <a href="javascript:;">获取短信验证码</a>
                                    </li>
                                    <li>
                                        <input type="text" class="input-code" placeholder="验证码"><span class="code"
                                            title="点击切换">
                                            <span
                                                style="color:#74675a;display:inline-block;transform:rotate(-8deg);">4</span>
                                            <span
                                                style="color:#135784;display:inline-block;transform:rotate(14deg);">7</span>
                                            <span
                                                style="color:#654321;display:inline-block;transform:rotate(28deg);">Q</span>
                                            <span
                                                style="color:#c317e3;display:inline-block;transform:rotate(-30deg);">V</span>
                                            <span
                                                style="color:#02468a;display:inline-block;transform:rotate(40deg);">Y</span>
                                            <span
                                                style="color:#123345;display:inline-block;transform:rotate(-24deg);">P</span>
                                        </span>
                                        <a href="#" class="huan">看不清？换一张</a>
                                    </li>
                                    <li class="wid">
                                        <input type="text" id="ph-code" placeholder="请输入手机验证码">
                                    </li>
                                    <div class="bt">
                                        <div class="clear"></div>
                                        <a href="../html/regist.html">登 录</a>
                                    </div>
                                    <div class="about">
                                        <div class="lines"></div>
                                        <div class="glup">
                                            <span class="blank10"></span>
                                            <h2 class="hezuo">使用合作网站账号登录凡客</h2>
                                            <p class="log-h">
                                                <a href="javascript:;"></a>
                                                <a href="javascript:;"></a>
                                                <a href="javascript:;"></a>
                                                <a href="javascript:;"></a>
                                                <a href="javascript:;"></a>
                                                <a href="javascript:;"></a>
                                            </p>
                                        </div>
                                    </div>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <script>
                $().ready(function () {
                    $(function () {
                        $(".nav a").off("click").on("click", function () {
                            var index = $(this).index();
                            $(this).addClass("on").siblings().removeClass("on");
                            $(".contentbox .box").eq(index).addClass("active").siblings().removeClass("active");
                        });
                    });
                    $('button').mousemove(function () {
                        $('button').css('font-weight', 'bold');
                    });
                    $('button').mouseout(function () {
                        $('button').css('font-weight', 'normal');
                    });
                })
            </script>
            <div class="advert">
                <img src="../img/login120412_newlogo.jpg" id="_advertImage" style="width: 465px">
            </div>
        </div>


    </main>
    <!-- 尾部 -->
    <footer class="wrapper">
        <div class="btm">
            <div class="text-p">
                <p>Copyright 2007 - 2019 vancl.com All Rights Reserved 京ICP证100557号 京公网安备11011502002400号
                    出版物经营许可证新出发京批字第直110138号</p>
                <p> 凡客诚品（北京）科技有限公司</p>
            </div>
            <div class="partner">
                <a href="javascript:;"></a>
                <span></span>
                <a href="javascript:;"></a>
                <a href="javascript:;"></a>
            </div>
        </div>
    </footer>
</body>

</html>